{extend name="public/base"/}
{block name="style"}
<style>
.chapterNoPayBox{margin:10px;}
.chapterNoPayBox .liebiaoBox{border:1px solid #efeff4; height:45px; line-height:45px; text-align:center; font-size:16px;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;}
.chapterNoPayBox .liebiaoBox a{display:block}
.chapterNoPayBox h5{ height:45px; line-height:45px; text-align:center; font-size:16px; color:#eb4f38}
.chapterNoPayBox .titleBox{margin:10px 0px; font-size:16px; text-align:center}
.chapterNoPayBox .priceBox{margin:10px 0px; font-size:14px; text-align:center}
.btn_top {
    margin:0 auto;
    width: 290px;
    height: 44px;
    line-height: 44px;
    background: #fee100;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 16px;
    margin-top: 15px;
    display: block;
    text-align: center;
}
</style>
{/block}
{block name="body"}
	<header class="ui-header">  
	    <div class="ui-icon-left">
	        <a href="javascript:history.back(-1)" class="ui-icon icon-back"></a>
	    </div>
	    <h1 class="ui-title">整本购买</h1>
	    <div class="ui-icon-right">
	        <a href="javascript:;" class="ui-icon icon-menu"></a>
	    </div>
	    <!--导航-->
	    {block name="include"}{include file="public:dropnav" /}{/block}
	</header>
	<div class="weui-content">
		<div class="page-cells">
		    <div class="chapterNoPayBox">
				<h5>全本仅需{$sumegold}枚阅读币！</h5>
				<div class="liebiaoBox"><a href="{:url('novel/chapter/index',array('id'=>$bookinfo.id))}">《{$bookinfo.title}》章节列表</a></div>
				<div class="titleBox">当前章节：{$chapterinfo.chaptername}</div>
				<div class="priceBox">账户剩余阅读币：{$egold.egold} 枚； <strong style="color:red;">全本</strong>所需阅读币：{$sumegold}枚</div>
				{if $egold.egold >=$sumegold}
					<a href="Javascript:;" onclick="allbookbuy()" class="btn_top">全本购买</a>
				{else/}
					<a href="/pay/index?backurl={$backurl}" class="btn_top">立即充值</a>
				{/if}
			</div>
			
		</div>

	</div>
    <!--加入书架成功提示-->
    <div id="toast" style="display: none;">
        <div class="weui-mask_transparent"></div>
        <div class="weui-toast">
            <i class="weui-icon-success-no-circle weui-icon_toast"></i>
            <p class="weui-toast__content">sucess</p>
        </div>
    </div>

{/block}
{block name="script"}
	<script src="__PUBLIC__/novel/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="__PUBLIC__/novel/js/common.js" type="text/javascript" charset="utf-8"></script>
    <script src="__PUBLIC__/novel/js/weui.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript" src="/public/static/js/jquery.cookie.js"></script>
    <script type="text/javascript">
		
    <!--
		function allbookbuy(){
			var uid = {:session('user_auth.uid')},
			    url = "{:url('novel/chapter/batchbuy',array('bookid'=>$bookinfo.id,'chapterid'=>$chapterinfo.id))}",
				bookid= "{$bookinfo.id}",
				bookname= "{$bookinfo.title}",
				chapterid= "{$chapterinfo.id}",
				sumegold = {$sumegold};

			$.ajax({
			  url:url,
			  async: false,
			  dataType:'json',
			  data : {'uid':uid,'bookname':bookname,'sumegold':sumegold},
			  type:'post',
			  success:function(json){
				if(json.code == 1){	
					message(1,json.msg);
					setTimeout(function () {
						location.href = "/chapter/read/"+bookid+"/"+chapterid+"/";
					}, 1000);
				}else{
				   message(2,json.msg)
				}
			  },
			  error:function(){
				message(2,"对不起，服务器繁忙，请稍后再试!")
			  }
			});
		}
		
    //-->
    </script>
{/block}


